home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEM / I-M / LineShare DEMO.sea / LineShare Scripts / Supra Fax2&Hermes < prev    next >
Text File  |  1993-01-28  |  7KB  |  315 lines

  1. !
  2. ! LineShare™ Script for Supra modems
  3. ! This script is designed for Class 2 fax software and -
  4. ! ••• Make sure that you have "H" or better ROMs in your modem!
  5. !
  6. ! If you want to modify this script for your modem, pay attention to
  7. ! the line marked "#### Settings ####" - it should be modified first
  8. ! This script is written to use with the Hermes™ BBS on the "Hermes" subPort:
  9. ! this application sets the modem into the "V0" mode.
  10. ! This script doesn't set the "V0" mode, but instead - translates all CONNECT
  11. ! messages into their numeric values
  12. ! This trick is marked with the "$$$" symbols
  13. !
  14. ! ------------------------------------------
  15. ! Resetting the modem:
  16. ! ------------------------------------------
  17. @Hangup
  18.   SetTries 2
  19.   Flush
  20.   HsReset 0,0,17,19,0,0
  21. !
  22. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  23. ! to enter the command mode
  24. !
  25. @Label 1
  26.   matchclr
  27.   matchstr 1 2 "OK\r\n"
  28.   write "ATH0&F1\r"
  29.   matchread 20
  30.   Write "+++"
  31.   DtrClear
  32.   pause 10
  33.   DtrSet
  34. !
  35.   DecTries
  36.   IfTries 0 1
  37. !
  38. ! OSErr -6019 "Modem error - the modem is not responding"
  39. !
  40.   exit -6019
  41. @Label 2
  42.   write "AT+FCLASS=0\r"
  43.   Jsr 100
  44.   write "AT+FAA=0\r"
  45.   Jsr 100
  46.   exit 0
  47. ! ------------------------------------------
  48. !    Receiving incoming calls
  49. ! ------------------------------------------
  50. @ANSWER
  51. @Label 10
  52. !
  53. ! Set the modem preferred speed first
  54. !
  55.   SERRESET 2400,0,8,1
  56.   Jsr 80
  57. !
  58. ! Set the common options
  59.   Jsr 70
  60. !
  61. ! Set the communication options:
  62. ! • X4 -Extended response set
  63. ! • N1 -Connect at the highest rate
  64. ! • \N3 - Enable MNP/V42 connections (for Hermes)
  65. ! • &K4 - Xon/Xoff flow control (for Fax)
  66. !
  67. @Label 11
  68. ! #### Settings - change this according to the type of modem you have ####
  69.   Write "ATX4N1\\N3&K4\r"
  70.   Jsr 100
  71. !
  72. ! Set the "work" speed
  73. !
  74. @Label 12
  75.   SERRESET 19200,0,8,1
  76.   Jsr 80
  77. !
  78. ! Set Fax parameters: LID, DCC,BOR
  79. !
  80.   Write "AT+FCLASS=2\r"
  81.   Jsr 100
  82.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  83.   Jsr 100
  84.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  85.   Jsr 100
  86.   Write "AT+FBOR=1\r"
  87.   Jsr 100
  88. !
  89. ! Allow modem to receive fax messages
  90. !
  91.   Write "AT+FCR=1\r"
  92.   Jsr 100
  93. !
  94. ! Tell the modem to determine the type of the incoming call
  95. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  96. !
  97.   Write "ATS0=^4+FAA=1\r"
  98.   Jsr 100
  99. !
  100. ! Everything is ready - let's sit and wait for a call
  101. ! We'll wait for 2 minutes, then reinitiate the modem
  102. !
  103. @Label 20
  104.   MatchClr
  105.   matchstr 1  20 "RING\r\n"
  106.   matchstr 2  40 "\r\n+FCON"
  107.   matchstr 3  10 "\r\nNO "
  108.   matchstr 4  10 "\r\nBUSY"
  109.   matchstr 5  21 "\r\nCONNECT 1200"
  110.   matchstr 6  22 "\r\nCONNECT 2400"
  111.   matchstr 7  23 "\r\nCONNECT 4800"
  112.   matchstr 8  24 "\r\nCONNECT 7200"
  113.   matchstr 9  25 "\r\nCONNECT 9600"
  114.   matchstr 10 26 "\r\nCONNECT 12000"
  115.   matchstr 11 27 "\r\nCONNECT 14400"
  116.   matchstr 12 28 "\r\nCONNECT 19200"
  117. !
  118.   Matchread 1200
  119.   jump 10
  120. !
  121. ! Data connection has been established (we read "CONNECT")
  122. ! $$$
  123. ! $$$ Put the numeric response back to the buffer and attach the "Data" subPort
  124. ! $$$ Since we didn't use "Adjust BPS", we don't adjust the port speed
  125. ! $$$ (make sure that your BBS is prepeared to work in this mode
  126. @Label 21
  127.   jsr 35
  128.   QueueInput "5\r"
  129.   Jump 30
  130. @Label 22
  131.   jsr 35
  132.   QueueInput "10\r"
  133.   Jump 30
  134. @Label 23
  135.   jsr 35
  136.   QueueInput "11\r"
  137.   Jump 30
  138. @Label 24
  139.   jsr 35
  140.   QueueInput "15\r"
  141.   Jump 30
  142. @Label 25
  143.   jsr 35
  144.   QueueInput "12\r"
  145.   Jump 30
  146. @Label 26
  147.   jsr 35
  148.   QueueInput "16\r"
  149.   Jump 30
  150. @Label 27
  151.   jsr 35
  152.   QueueInput "17\r"
  153.   Jump 30
  154. @Label 28
  155.   jsr 35
  156.   QueueInput "14\r"
  157. @Label 30
  158.   Attach "Hermes" (DTR,BREAK,Escape,IDLELimit=60)
  159. !
  160. ! This routine clears the input buffer (after the CONNECT) till "\r\n"
  161. !
  162. @Label 35
  163.   MatchClr
  164.   MatchStr 1 36 "\r\n"
  165.   MatchRead 10
  166. @Label 36
  167.   return
  168.  
  169. !
  170. ! Fax connection has been established (we read "+FCON")
  171. ! Put the +FCON back to the buffer,
  172. ! if it was an incoming call, put the "RING" before the "+FCON"
  173. ! Attach the "Fax" subPort
  174. !
  175. @Label 40
  176.   QueueInput "\r\n+FCON"
  177.   ifOriginate 41
  178.   QueueInput "\r\nRING\r\n"
  179. @Label 41
  180.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  181. ! ------------------------------------------
  182. ! Originating a call through the "Hermes" subport
  183. ! ------------------------------------------
  184. @ORIGINATE "Hermes"
  185. !
  186. ! Set the Data speed
  187. !
  188.   SERRESET 2400,0,8,1
  189.   Jsr 80
  190. !
  191. ! Set the common options
  192. !
  193.   Jsr 70
  194. !
  195. ! Set the Data mode
  196. ! • N1 to connect at the highest rate
  197. ! • S7 is set to 1.5 minute for international calls
  198. ! • &S1 should be set if necessary (see above) 
  199. !
  200.   Write "ATN1S7=90&S1+FCLASS=0\r"
  201.   Jsr 100
  202. !
  203. ! Now emit all commands that the application has sent to that port
  204. !
  205.   Jsr 60
  206. !
  207. ! Prepare to receive all error result codes
  208. !
  209.   Jsr 90
  210.   matchstr 1 21 "\r\nCONNECT"
  211. !
  212. ! Dial the number
  213. !
  214.   HsReset *
  215.   Write "ATD^1\r"
  216.   MatchRead 900
  217.   Write "\r"
  218.   Exit -6019
  219. ! ------------------------------------------
  220. ! Originating a call through the "Fax" subPort
  221. ! ------------------------------------------
  222. @ORIGINATE "Fax"
  223. !
  224. ! Set the "Fax" speed
  225. !
  226.   SERRESET 19200,0,8,1
  227.   Jsr 80
  228. !
  229. ! Set the common options
  230. !
  231.   Jsr 70
  232. !
  233. ! Set the Fax mode
  234. ! &S0: DSR always on (see above)
  235. !
  236.   Write "AT&S0+FCLASS=2\r"
  237.   Jsr 100
  238. !
  239. ! Now emit all commands that the application has sent to that port,
  240. ! Prepare to receive all error result codes
  241. !
  242. @LABEL 50
  243.   Jsr 60
  244.   Jsr 90
  245.   MatchStr 1 40 "\r\n+FCON"
  246.   HsReset *
  247.   Write "ATD^1\r"
  248.   MatchRead 700
  249.   Write "\r"
  250.   Exit -6019
  251. !
  252. ! This section emits all modem commands sent from the client application
  253. ! For each set of commands the "OK" answer is awaited
  254. !
  255. @Label 60
  256.   EmitStart
  257. @Label 61
  258.   EmitCommand 62
  259.   Jsr 100
  260.   Jump 61
  261. @Label 62
  262.   return
  263. !
  264. ! This section initiates the modem before ANSWER and ORIGINATEs:
  265. ! factory settings + speaker control +
  266. ! reset on Dtr drop + DCD valid
  267. ! Verbal responses mode, no echo 
  268. !
  269. @Label 70
  270.   Write "ATM^2L^3&D3&C1V1E0\r"
  271.   Jsr 100
  272.   return 
  273. !
  274. ! This section syncronize the modem after the serial port speed switching
  275. !
  276. @Label 80
  277.   ChrDelay 1
  278.   Write "AT\r"
  279.   ChrDelay 0
  280.   Jsr 100
  281.   return
  282. !
  283. ! Prepare to receive error result codes
  284. !
  285. @Label 90
  286.   MatchClr
  287.   MatchStr 2 91 "NO DIALTONE\r\n"
  288.   MatchStr 3 92 "BUSY\r\n"
  289.   MatchStr 4 93 "NO CARRIER\r\n"
  290.   MatchStr 5 94 "NO ANSWER\r\n"
  291.   return
  292. @Label 91
  293.   exit -6020
  294. @Label 92
  295.   exit -6022
  296. @Label 93
  297.   exit -6021
  298. @Label 94
  299.   exit -6023
  300. !
  301. ! Processing the AT command:
  302. ! OK -> proceed
  303. ! ERROR or TimeOut ->exit -6019
  304. ! It can be called AFTER the "Write" command, since LineShare buffers input
  305. !
  306. @Label 100
  307.   MatchClr
  308.   MatchStr 1 102 "\r\nOK\r\n"
  309.   MatchStr 2 101 "\r\nERROR\r\n"
  310.   MatchRead 20
  311. @Label 101
  312.   Exit -6019
  313. @Label 102
  314.   return
  315.